const BaseMapper = require('../../library/base-mapper');
const AnchorModel = require('../model/anchor')
const {Op} = require("sequelize");

module.exports = class AnchorMapper extends BaseMapper {
    constructor() {
        super();
        this.model = AnchorModel
    }

    handleSearch(params, options) {
        if(params['name']){
            options.where['name'] = {
                [Op.substring]: params['name']
            }
        }
        if(params['game_id']){
            options.where['game_id'] = {
                [Op.eq]: params['game_id']
            }
        }
        super.handleSearch(params, options)
    }
}
